'''
Company: TWL
Author: xue jian
Email: xuejian@kanzhun.com
Date: 2020-11-09 09:27:15
'''
#
# @lc app=leetcode.cn id=973 lang=python3
#
# [973] 最接近原点的 K 个点
#

# @lc code=start
from typing import List
class Solution:
    def kClosest(self, points: List[List[int]], K: int) -> List[List[int]]:
        dis = []
        for point in points:
            tmp = point[0]**2+point[1]**2
            dis.append((tmp, point))
        dis.sort()
        ans = []
        for i in range(K):
            ans.append(dis[i][1])
        return ans
        
# @lc code=end

